﻿using MediatR;
using T.Basic.API.Appliction.Command.LineCommand;
using T.Basic.Domain.T.Basic.Model;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.LineHanders
{
    /// <summary>
    /// 新增线路
    /// </summary>
    public class LineCreateCommandHandler : IRequestHandler<LineCreateCommand, int>
    {
        private readonly ILineRepository _lineRepository;
        public LineCreateCommandHandler(ILineRepository lineRepository) 
        { 
            _lineRepository = lineRepository;
        }

        public async Task<int> Handle(LineCreateCommand request, CancellationToken cancellationToken)
        {
            return await _lineRepository.AddAsync(request);
        }
    }
}
